from urllib.request import urlopen
from bs4 import BeautifulSoup


def worm(temp):
    cards = []
    url = "http://acg17.com/category/meitu/pixiv-painter/page/{:d}/".format(temp)
    html = urlopen(url)
    bsObj = BeautifulSoup(html.read(), features='html.parser')
    for pic in bsObj.findAll('article'):
        url2 = pic.a['href']
        html2 = urlopen(url2)
        bsObj2 = BeautifulSoup(html2.read(), features='html.parser')
        for photo in bsObj2.findAll('p'):
            if photo.img != None:
                if photo.img['src'][24] == 'l':
                    break
                elif photo.img['src'][-3:] == 'gif':
                    pass
                else:
                    cards.append(photo.img['src'])
        for card in cards:
            print(card)
for i in range(10, 20):
    print("这是第{:d}页的本子  （*∩_∩*）′ 献上 ".format(i))
    worm(i)
    print("\n")
print("所有的本子都爬好了哦  得意 <(￣︶￣)>")
